<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<script>
            function radioButton(radio) {
            var id = radio.name.substring(radio.name.lastIndexOf(':'));
            var el = radio.form.elements;
            for (var i = 0; i < el.length; i++) {
                if (el[i].name.substring(el[i].name.lastIndexOf(':')) == id) {
                    el[i].checked = false;
                }
            }
            radio.checked = true;
        }
 </script>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Comprar Passeios</title>
</head>
<body>
<f:view>
	<h:form>
		<center>
		<h2>Passeios disponiveis em <h:selectOneMenu
			value="#{comprarPasseio.nomeCidadeEscolhidaJSP}" onchange="submit();"
			immediate="true"
			valueChangeListener="#{comprarPasseio.MudarListaPasseios}">
			<f:selectItems value="#{comprarPasseio.cidadesJSP}"></f:selectItems>
		</h:selectOneMenu></h2>
		<div
			style="align: center; background-color: #cccccc; padding-left: 5px; padding-right: 5px; padding-top: 5px; padding-bottom: 5px; width: 621px; clear: both; height: 124px">

		<h:dataTable value="#{comprarPasseio.passeiosJSP}" var="item"
			binding="#{comprarPasseio.htmlDataTablePasseioJSP}" bgcolor="#BDDCFD"
			border="2" style="width: 594px">
			<h:column id="selecionarComentario">
				<f:facet name="header">
					<h:outputText value="Selecionar" />
				</f:facet>
				<h:selectOneRadio onclick="radioButton(this);"
					valueChangeListener="#{comprarPasseio.setPasseioJSP}">
					<f:selectItem itemValue="null" />
				</h:selectOneRadio>
			</h:column>
			<h:column id="Nome">
				<f:facet name="header">
					<h:outputText value="Nome" />
				</f:facet>
				<h:outputText value="#{item.nome}" />
			</h:column>
			<h:column id="Descricao">
				<f:facet name="header">
					<h:outputText value="Descricao" />
				</f:facet>
				<h:outputText value="#{item.descricao}" />
			</h:column>
		</h:dataTable></div>
		<h:commandButton value="Comprar" action="#{comprarPasseio.comprar}"></h:commandButton>
		<h:commandButton value="Voltar" action="#{comprarPasseio.voltar}"></h:commandButton>
		</center>
	</h:form>
</f:view>
</body>
</html>